package org.android.kumoh_ing;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.Toast;

public class GroupPlusWebViewActivity extends Activity {
	 private WebView webView ;
	 
	 public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.creategroup);
	        webView = (WebView) findViewById(R.id.webview);
	        Button btnBack=(Button)findViewById(R.id.btn);
	        
	        btnBack.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					finish();
				}	
	        });
	        
	        WebSettings webSettings = webView.getSettings();
	        
	        webSettings.setJavaScriptEnabled(true);
	        webSettings.setPluginsEnabled(true);
	        webSettings.setPluginState(WebSettings.PluginState.ON_DEMAND);
	        webSettings.setSupportZoom(true);
	        webSettings.setBuiltInZoomControls(true);
	        webSettings.setBlockNetworkImage(false);
	        webSettings.setLoadsImagesAutomatically(true);
	        webSettings.setUseWideViewPort(true);
	        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
	        webSettings.setSupportMultipleWindows(true);
	        
	       
	        webView.setWebViewClient(new owlWebViewClient());
	        webView.loadUrl("http://www.facebook.com/groups/");
	        
	 }
	 Activity act = this; 
	 
	 private class owlWebViewClient extends WebViewClient{
		 public boolean shouldOverrideUrlLoading(WebView view, String url){
			 view.loadUrl(url);
			 return true;
		 }
		 public void onReceivedError(WebView view, int errorCode, 
				 String description, String failingUrl){
			 Toast.makeText(act, "Some Error :"+description, Toast.LENGTH_SHORT).show();
		 }
	 }
	
}

